﻿using MediatR;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;
namespace U.Enterprise.Api.Applications.ReturnWeighing
{
    public class ReturnWeighingDelHandler : IRequestHandler<ReturnWeighingDelCommond, Resqults>
    {


        private readonly IBateRepository<Byproduct> _Byproduct;

        public ReturnWeighingDelHandler(IBateRepository<Byproduct> byproduct)
        {
            _Byproduct = byproduct;
        }

        public async Task<Resqults> Handle(ReturnWeighingDelCommond request, CancellationToken cancellationToken)
        {
            var list = new Resqults() { Code = 0 };


            var query = _Byproduct.GetAll().Where(x => x.ByproductId == request.ByproductId).FirstOrDefault();

            if (query!=null)
            {
               


                _Byproduct.Update(query);
            }


            return list;





        }
    }
}
